import { request } from '@/utils/request'
import qs from 'qs'

/**
 * 帐号登录
 * @param {String} account - 用户名
 * @param {String} password - 密码
 * @returns Promise
 */

export const userAccountLogin = ({ username, password, nickname, sex, phone }) => {
  return request('login/submit.do', 'post', qs.stringify({ username, password, nickname, sex, phone }))
}
export const userAccountLogon = ({ username, password }) => {
  return request('login/userlogin.do', 'post', qs.stringify({ username, password }))
}

export const getUserInfo = () => {
  return request('user/currentuser.do', 'get')
}
export const setUserInfo = data => {
  return request('user/changeuserinfo.do', 'post', qs.stringify(data))
}
// 修改密码
export const updataPass = data => {
  return request('user/changepwd.do', 'post', qs.stringify(data))
}
// 查询省
export const queryProvinces = () => {
  return request('area/queryprovinces.do', 'GET')
}

// 查询城市
export const queryCities = data => {
  return request('area/querycities.do', 'post', qs.stringify(data))
}// 发布评论
export const sendComment = data => {
  return request('comments/sendcomment.do', 'post', qs.stringify(data))
}
// 查询留言
export const queryComment = data => {
  return request('comments/query.do', 'post', qs.stringify(data))
}
// 回复留言
export const replyComment = data => {
  return request('comments/sendreply.do', 'post', qs.stringify(data))
}